//导入要处理的组件
import Main from "./Confirm.vue";
//导入vue
import Vue from "vue";

//生成一个构造器
const MessageConstructor = Vue.extend(Main);
// 这里面要处理逻辑得话自行加上就可
const Confirm = (obj, props) => {
  return new Promise((resolve, reject) => {
    const submitCallback = () => {
    reject()
    document.body.removeChild(msg.$el)
    }
    const cancelCallback = () => {
       resolve()
       document.body.removeChild(msg.$el)

    }
    var newobj={...obj,submitCallback,cancelCallback}
    const msg = new MessageConstructor({data:newobj})	
    //将构造器生成的对象挂载
    msg.$mount()
    document.body.appendChild(msg.$el);
  })
};

export default Confirm;
